ref: codebase cleanup sweep — dedup, constant, dead-code#847
Merged
Conversation
The "_BASHUNIT_EMPTY_" wire token was hardcoded in three places across two files: encode_base64 (helpers.sh) emits it and both decode sites (helpers.sh, runner.sh) recognize it. Extract it into a single constant next to _BASHUNIT_BASE64_WRAP_FLAG in state.sh so the encode and decode sides can never drift. No behavior change; the on-wire byte sequence is unchanged. Claude-Session: https://claude.ai/code/session_01JSeB8UzLCpqst55hAK6dED
Drop the dangling "behave exactly as the previous command-substitution did" clause (refactor-history narration with no referent in the current code) while keeping the useful contract: output matches $(printf '%s\n' "$@") exactly, including trailing-newline stripping. Claude-Session: https://claude.ai/code/session_01JSeB8UzLCpqst55hAK6dED
Route the specialized assertions (arrays, dates, duration, json, files, folders) and the bashunit::assertion_failed facade through the existing fork-free bashunit::assert::label_to_slot slot helper instead of re-deriving the label with a per-call find_test_function_name + normalize_test_function_name command substitution, matching assert.sh. Output, custom-label overrides ($2 folders, $3 files) and the derived default are unchanged; label resolution stays on the failure path. Collapse the three byte-identical skipped/incomplete/risky summary renderers into one bashunit::console_results::flush_deferred_block; each caller keeps its own guard.
The local array carried a shellcheck SC2034 (unused) disable; only the scalar provider_data_count is read in the counting loop. Leftover from an earlier provider-counting refactor. Claude-Session: https://claude.ai/code/session_01JSeB8UzLCpqst55hAK6dED
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 Background
A second multi-agent cleanup sweep across the same eight quality axes as #843. Five axes were already clean (constants mostly, fragile constructs, defensive code, source cycles, comments); four small, provably-safe changes surfaced.
💡 Changes
bashunit::assert::label_to_slothelper instead of a per-callfind_test_function_name+normalizecommand substitution (34 sites, matchingassert.sh); and the three byte-identical skipped/incomplete/risky summary renderers collapse into oneflush_deferred_block. Net −70 lines, fewer forks, identical output._BASHUNIT_EMPTY_base64 wire sentinel (hardcoded in 3 encode/decode sites) is centralized into_BASHUNIT_BASE64_EMPTY_SENTINELinstate.shso the two sides can't drift.provider_dataarray infind_total_teststhat carried a shellcheck SC2034 (unused) disable — only the scalar counter is read.join_to_slotcontract comment (dropped refactor-history narration).Label resolution is behavior-identical: both the old and new resolvers scan the full
FUNCNAMEstack for atest_*frame, so the extra helper frame is irrelevant whenever an assertion runs inside a test (always, in practice). Verified: full suite +--parallel --simple --strict(1384 passed), the label-sensitive failure-path tests,make sa,make lint,./build.sh --verify— all green, run locally without cross-process interference.https://claude.ai/code/session_01JSeB8UzLCpqst55hAK6dED